package com.woniuxy.java106crm.controller;

import com.woniuxy.java106crm.annotation.RequireMethod;
import com.woniuxy.java106crm.entity.Customer;
import com.woniuxy.java106crm.entity.Product;
import com.woniuxy.java106crm.request.ResPage;
import com.woniuxy.java106crm.request.ResponseResult;
import com.woniuxy.java106crm.service.BasicDataService;
import com.woniuxy.java106crm.service.CustomerService;
import com.woniuxy.java106crm.vo.FindProductVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "查询产品信息模块API文档")
@Slf4j
@RestController
@RequestMapping("/basicData")
public class BasicDataController {
    @Resource
    private BasicDataService basicDataService ;

    //根据姓名查询产品信息
    @RequireMethod("根据姓名查询产品信息")
    @PostMapping("/findProductByName")
    public ResponseResult<ResPage<List<Product>>> findProductByName(@RequestBody FindProductVo findProductVo){
        log.debug(findProductVo.toString());
       ResPage<List<Product>> products = basicDataService.findProductByName(findProductVo);
        return new ResponseResult<>(ResponseResult.OK,products);
    }


}
